//
//  WeatherViewController.m
//  auto
//
//  Created by Scott on 14/10/29.
//  Copyright (c) 2014年 Ryo Aoyama. All rights reserved.
//

#import "WeatherViewController.h"

@interface WeatherViewController ()

@end

@implementation WeatherViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    // 天气预报的WebView界面

    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 20 , self.view.frame.size.width, self.view.frame.size.height)];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://tianqi.2345.com/dalian/54662.htm"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
    
    [webView loadRequest:request];
    
    [self.view addSubview:webView];
    
    // 取消webView的反弹效果
    webView.scrollView.bounces = NO;
    
    [self returnToMainPage];
    
}

- (void)returnToMainPage
{
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];
    
    // 向右方向轻扫
    swipe.direction = UISwipeGestureRecognizerDirectionRight;
    
    [self.view addGestureRecognizer:swipe];
    
}
    

- (void)swipeAction:(UISwipeGestureRecognizer *)swipe
{
    
    [self dismissViewControllerAnimated:YES completion:^{
        
        
    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
